<?php
require_once dirname(dirname(__FILE__)) . '/config/config.php';
require_once DOCUMENT_ROOT . DIR_SHARED_DAO . "dao_buy_doc.php";
require_once DOCUMENT_ROOT . DIR_SHARED_DAO . "dao_buy_status.php";
require_once DOCUMENT_ROOT . DIR_SHARED_LIBRARIES . 'lib_redirect.php';

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of api_security
 *
 * @author Thien
 */
class api_buy {
    
    public static function get_all_buy_docs() {
        $buy_doc_access = new dao_buy_doc();
        return $buy_doc_access->get_all();
    }
    
    public static function get_all_buy_statuses() {
        $buy_status_access = new dao_buy_status();
        return $buy_status_access->get_all();
    }
    
    public static function delete_buy_doc($id) {
        $buy_doc_access = new dao_buy_doc();
        $buy_doc_access->delete($id);
        return TRUE;
    }

    public static function delete_buy_status($id) {
        $buy_status_access = new dao_buy_status();
        $buy_status_access->delete($id);
        return TRUE;
    }

    public static function save_buy_doc($buy_doc_id, $user_id, $doc_id,
            $buy_status_id) {
        $buy_doc_access = new dao_buy_doc();
        $buy_doc_access->save($buy_doc_id,$user_id,$doc_id,$buy_status_id);
        return TRUE;
    }

    public static function save_buy_status($buy_status_id, $buy_status_name, $buy_status_detail) {
        $buy_status_access = new dao_buy_status();
        $buy_status_access->save($buy_status_id,$buy_status_name,$buy_status_detail);
        return TRUE;
    }
    
    public static function get_buy_doc_by_id($id) {
        $buy_doc_access = new dao_buy_doc();
        return $buy_doc_access->get_by_id($id);
    }
    
    public static function get_buy_status_by_id($id) {
        $buy_status_access = new dao_buy_status();
        return $buy_status_access->get_by_id($id);
    }
    
}
